
<?php 
        $speaker_list=$this->speaker_list;
        $value = 0;
        $option = array ();
        $speaker_list->buffer();  
?>

<div class="row container">
<div class="col-md-12"> 
<div class="panel panel-default">
	
	<div class="panel-heading">
	   <a href="<?php echo $this->url('resources',array('controller'=>'Session','action'=>'add'));?>" class="btn btn-info" role="button"><span class="glyphicon glyphicon-plus-sign" aria-hidden="true"></span> Add Sessions &raquo;</a>
	   <!-- <a href=" --><?php // echo $this->url('resources',array('controller'=>'Session','action'=>'search'));?><!-- " class="btn btn-info pull-right" role="button"><span class="glyphicon glyphicon-search" aria-hidden="true"></span> Search &raquo;</a> -->
	</div>
	
	<div class="panel-body">
	<div class="table-responsive">
		<table class="table table-bordered table-striped">
				<tr>
				    <th>No</th>
					<th>Topic</th>					
				    <th>Summit Year</th>
					<th>Medium</th>
					<th>Duration (Hrs:Min:Sec)</th>
					<th>Suitability</th>
					<th>Overview</th>
					<th>Remark</th>
					<th>Speaker</th>
					<th>Option</th>
				</tr>
				<?php $number=0;?>
				<?php foreach ($this->paginator as $session) : ?>
				<tr>       	
				            <td><?php echo ++$number; ?></td>		
        			        <td><?php echo $this->escapeHtml($session->TOPIC);?></td>
        			        <td><?php echo $this->escapeHtml($session->SUMMIT_YEAR);?></td>
        			            <?php 
            			            if($this->escapeHtml($session->MEDIUM)==1){
            			                $medium="Sinhala";
            			            }
            			            else if($this->escapeHtml($session->MEDIUM)==2){
            			                $medium="Tamil";
            			            }
            			            else if($this->escapeHtml($session->MEDIUM)==3){
            			                $medium="English";
            			            }
        			            ?>
        					<td><?php echo $medium;?></td>
        					<td><?php echo gmdate("H:i:s",$session->DURATION); ;?></td>
        					    <?php 
            			            if($this->escapeHtml($session->SECTOR)==1){
            			                $sector="Cooperate";
            			            }
            			            else if($this->escapeHtml($session->SECTOR)==2){
            			                $sector="Church or Non prifit";
            			            }
            			            else if($this->escapeHtml($session->SECTOR)==3){
            			                $sector="Both";
            			            }
        			            ?>
        					<td><?php echo $sector;?></td>
        					<td><?php echo $this->escapeHtml($session->OVERVIEW);?></td>
        					<td><?php echo $this->escapeHtml($session->REMARK);?></td>
        					    <?php
                					    foreach ($speaker_list as $speaker) :
                					    if($speaker->ID == $session->FK_SPEAKER_ID){
                					        $speaker_name=$speaker->FIRST_NAME." ".$speaker->LAST_NAME;
                					    }
                					    endforeach;
        					    ?>        					    
        					<td><?php echo $speaker_name;?></td>
        					<td>
                                 <div class="btn btn-default"><a href="<?php echo $this->url('resources',array('controller'=>'Session','action'=>'edit', 'id' => $session->ID));?>"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></a></div>                                 
                            </td>	        			
        		</tr>
        		<?php endforeach; ?>
		</table>
		<?php 
    		// add at the end of the file after the table
            echo $this->paginationControl(
            // the paginator object
            $this->paginator,
            // the scrolling style
            'sliding',
            // the partial to use to render the control
            'partial/paginator.phtml',
            // the route to link to when a user clicks a control link
            array(
               // 'route' => 'events'
                )
            );
         ?>
		
	</div>
	</div>
	<div class="pull-right" style="padding:0.2em 0 0 0.2em"><a href="<?php echo $this->url('resources',array('controller'=>'Speaker','action'=>'email'));?>" class="btn btn-info" role="button"><span class="glyphicon glyphicon-envelope" aria-hidden="true"></span> Email &raquo;</a></div>
	<div class="pull-right" style="padding:0.2em 0 0 0.2em"><a class="btn btn-info" role="button" onclick="window.print()" target="_blank"><span class="glyphicon glyphicon-print" aria-hidden="true"></span> Print	&raquo;</a></div>
</div>
</div>
</div>
